<!DOCTYPE html>


<html lang="zh-CN">


<head>
  <meta charset="utf-8" />
  <meta name="baidu-site-verification" content="code-kg5UjKJZM2" />
   
  <meta name="keywords" content="活,炼" />
   
  <meta name="description" content="shimmerjordan" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
  <title>
    软路由折腾笔记 |  丛烨-shimmerjordan
  </title>
  <meta name="generator" content="hexo-theme-ayer">
  
  <link rel="shortcut icon" href="/favicon.ico" />
  
  
<link rel="stylesheet" href="/dist/main.css">

  <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Shen-Yu/cdn/css/remixicon.min.css">
  
<link rel="stylesheet" href="/css/custom.css">

  
  <script src="https://cdn.jsdelivr.net/npm/pace-js@1.0.2/pace.min.js"></script>
  
  

<script type="text/javascript">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'G-Q0DT8B8VJW', 'auto');
ga('send', 'pageview');

</script>



  
<script>
var _hmt = _hmt || [];
(function() {
	var hm = document.createElement("script");
	hm.src = "https://hm.baidu.com/hm.js?6d06f826e125297d4ce0fa7a1449328e";
	var s = document.getElementsByTagName("script")[0]; 
	s.parentNode.insertBefore(hm, s);
})();
</script>


<link rel="alternate" href="/atom.xml" title="丛烨-shimmerjordan" type="application/atom+xml">
</head>

</html>

	<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome/css/font-awesome.min.css">
	<script src="https://cdn.jsdelivr.net/gh/stevenjoezhang/live2d-widget@latest/autoload.js"></script>


<body>
  <div id="app">
    
      
    <main class="content on">
      <section class="outer">
  <article
  id="post-soft_routing_setup"
  class="article article-type-post"
  itemscope
  itemprop="blogPost"
  data-scroll-reveal
>
  <div class="article-inner">
    
    <header class="article-header">
       
<h1 class="article-title sea-center" style="border-left:0" itemprop="name">
  软路由折腾笔记
</h1>
 

    </header>
     
    <div class="article-meta">
      <a href="/2023/01/07/soft-routing-setup/" class="article-date">
  <time datetime="2023-01-07T13:28:12.000Z" itemprop="datePublished">2023-01-07</time>
</a> 
  <div class="article-category">
    <a class="article-category-link" href="/categories/Network/">Network</a>
  </div>
  
<div class="word_count">
    <span class="post-time">
        <span class="post-meta-item-icon">
            <i class="ri-quill-pen-line"></i>
            <span class="post-meta-item-text"> 字数统计:</span>
            <span class="post-count">2.4k</span>
        </span>
    </span>

    <span class="post-time">
        &nbsp; | &nbsp;
        <span class="post-meta-item-icon">
            <i class="ri-book-open-line"></i>
            <span class="post-meta-item-text"> 阅读时长≈</span>
            <span class="post-count">9 分钟</span>
        </span>
    </span>
</div>
 
    </div>
      
    <div class="tocbot"></div>




  
    <div class="article-entry" itemprop="articleBody">
       
  <blockquote>
<p>软路由的入门折腾笔记，给自己以后换房子重新部署做个参考</p>
</blockquote>
<p>目前计划实现的功能：</p>
<ul>
<li>ipv6公网的DDNS，绑定域名之后实现公网访问</li>
<li>广告过滤，（翻阅长城的功能暂定不加）</li>
<li>利用<code>x-ui</code>搭建一个小型流量中转站</li>
<li>搭建青龙面板跑一些基础的脚本</li>
<li>离线下载</li>
<li>私有云</li>
</ul>
<span id="more"></span>
<h1 id="软路由刷机"><a href="#软路由刷机" class="headerlink" title="软路由刷机"></a>软路由刷机</h1><blockquote>
<p>第一次选用了NanoPi R2S作为入门机器，这个刷机流程记录了的是R2S的。后面更换机型需要重新找固件，比较靠谱的有<a target="_blank" rel="noopener" href="https://www.right.com.cn/">恩山</a>、知乎等等</p>
<p>R2S性能比较差，部署不了几个功能。后面打算直接上x86的软路由一步到位</p>
</blockquote>
<h2 id="准备工作"><a href="#准备工作" class="headerlink" title="准备工作"></a>准备工作</h2><ol>
<li><p>刷机软件：<a target="_blank" rel="noopener" href="https://www.balena.io/etcher/">ethcer</a> or <a target="_blank" rel="noopener" href="https://rufus.ie/zh/">rufus</a>；</p>
</li>
<li><p>软路由系统固件：（这个R2S刷的openwrt是在恩山上找的。<a target="_blank" rel="noopener" href="https://github.com/klever1988/nanopi-openwrt/releases/">klever</a>版本的话，选择版本时请注意带slim的为轻量级固件，因为R2S实在性能堪忧）<a target="_blank" rel="noopener" href="https://www.right.com.cn/forum/thread-4387071-1-1.html">恩山无线论坛-openwrt-r2s</a>；初始管理地址：<code>192.168.8.1</code>，初始管理密码：空；</p>
</li>
<li><p>用来刷系统的存储设备（R2S这里用的TF卡，要搭读卡器。后面x86软路由换用U盘）；</p>
</li>
<li><p>电脑＋网线</p>
</li>
</ol>
<h2 id="简要流程"><a href="#简要流程" class="headerlink" title="简要流程"></a>简要流程</h2><ol>
<li><p>系统烧录：这个没什么好说的，用刷机软件把下载好的固件镜像刷进存储介质就行，需要注意的点只是：<strong>刷入成功后会提醒你格式化U盘，千万不要！！！</strong></p>
</li>
<li><p>R2S简单初始化：完成上述步骤后，将R2S电源接通，用网线把PC与R2S的<code>LAN</code>口相连。然后在浏览器根据固件设置的默认初始管理地址和密码进入后台。然后进行一些基本的设置：</p>
<ul>
<li><p>设置<code>LAN</code>口：网络 - 接口 - <code>LAN</code>口 - 高级设置 - 打开<code>动态DHCP</code></p>
</li>
<li><p>设置<code>WAN</code>口：</p>
<ul>
<li><p>如果家里是<strong>光猫拨号</strong>上网，那就设置模式为<code>DHCP</code>客户端。  </p>
</li>
<li><p>如果家里是<strong>路由器拨号</strong>上网，或者是使用<strong>R2S做主路由</strong>，设置为<code>PPPOE</code>拨号上网，输入宽带账号和密码，保存并应用。</p>
</li>
</ul>
</li>
<li><p>设置好之后将光猫与R2S的<code>WAN</code>口连接起来，这时候应该就可以上网了。拨号成功后会显示IP地址。</p>
</li>
</ul>
</li>
</ol>
<blockquote>
<p>关于这个拨号账号密码以及光猫桥接模式的设置，不同型号的光猫配置方式略有不同；关于这次配置的是移动宽带的GS3101，可以参考<a href="/2023/01/09/GS3101-bridge/" title="移动光猫吉比特GS3101超级账号获取更改桥接">移动光猫吉比特GS3101超级账号获取更改桥接</a></p>
</blockquote>
<ol>
<li>如果要把R2S设置为主路由，将无线路由器的LAN口与PC相连，进入管理后台（这次使用的HIKVISION的地址是<code>http://192.168.0.1/</code>）。开启DHCP后将光猫<code>LAN</code>口连接R2S的<code>WAN</code>口，R2S的<code>LAN</code>口连接路由器的<code>WAN</code>口，即可完成组网。</li>
</ol>
<h1 id="软路由扩容"><a href="#软路由扩容" class="headerlink" title="软路由扩容"></a>软路由扩容</h1><blockquote>
<p>一开始用的<code>squashfs</code> 文件系统的固件，虽然支持还原出厂设置，但是扩容起来很麻烦，后来改用<code>ext4</code>文件系统的固件了。</p>
</blockquote>
<ol>
<li><p>SSH登录OpenWrt后，安装磁盘分区工具，先后顺序不能错：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">opkg update</span><br><span class="line">opkg install block-mount e2fsprogs</span><br><span class="line">opkg update</span><br><span class="line">opkg install fdisk blkid vim</span><br><span class="line">opkg install cfdisk</span><br></pre></td></tr></table></figure>
<p>命令行中 <code>cfdisk</code> 、<code>fdisk</code> 均为磁盘分区工具，<code>e2fsprogs</code> 包含了 <code>mkfs</code> 命令，用于格式化分区。</p>
</li>
<li><p>使用<code>fdisk -l</code>查看分区列表，找到自己想要扩展的磁盘分区，我这里是<code>/dev/mmcblk0</code></p>
</li>
<li><p>使用<code>cfdisk /dev/mmcblk0</code> 命令进入磁盘分区界面（<code>/dev/mmcblk0</code>根据实际情况替换），通过键盘上下键切换到 <strong>Free space</strong> （剩余空间），左右键切换至 <strong>NEW</strong> （新增分区），然后按下回车键。分区类型设置为 <strong>Primary</strong> （主分区），按下回车键。左右键切换 <strong>Write</strong> 按下回车键，写入新分区。输入 <strong>yes</strong> 按下回车键，确认写入新分区。</p>
</li>
<li><p>切换 <strong>Quit</strong> ，按下回车键退出。运行 <code>fdisk -l</code> 命令，查看是否成功创建新分区。</p>
</li>
<li><p>格式化新分区：运行命令<code>mkfs.ext4 /dev/mmcblk0p3</code>，将新分区的文件系统格式化为 <code>ext4</code></p>
</li>
<li><p>挂载新分区：</p>
<ol>
<li><p>进入 Open­Wrt 管理后台，依次点击 <strong>系统</strong> - <strong>挂载点</strong> 找到并点击全局设置中的 <strong>生成配置</strong> 。如果没有自动生成，在挂载点手动添加。</p>
</li>
<li><p>在 <strong>挂载点</strong> 找到创建的新分区，点击 <strong>修改</strong> 重新调整挂载项目的设置。</p>
</li>
<li><p>勾选 <strong>启用此挂载点</strong>，<strong>挂载点</strong> 选择为 <strong>作为根文件系统使用</strong> ，完整复制根目录准备中的所有命令行后，点击 <strong>保存并应用</strong>。</p>
<blockquote>
<p>⚠️ <strong>上面复制得到的命令行不要直接运行！！！不要直接运行！！！否则报错。</strong></p>
</blockquote>
</li>
<li><p>需要手动修改命令行中 <code>mount /dev/sda1 /tmp/extroot</code> 为 <code>cfdisk</code> 创建的新分区盘符，例如这里应修改为 <code>mount /dev/mmcblk0p3 /tmp/extroot</code>，然后进入 SSH 终端，运行修改后的完整命令行，如下：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">mkdir -p /tmp/introot</span><br><span class="line">mkdir -p /tmp/extroot</span><br><span class="line">mount --bind / /tmp/introot</span><br><span class="line">mount /dev/mmcblk0p3 /tmp/extroot</span><br><span class="line">tar -C /tmp/introot -cvf - . | tar -C /tmp/extroot -xf -</span><br><span class="line">umount /tmp/introot</span><br><span class="line">umount /tmp/extroot</span><br></pre></td></tr></table></figure>
<p>回车键到底，直到跑完所有命令行。然后运行 <code>reboot</code> 重启 Open­Wrt后重新进入 SSH 终端运行 <code>df -h</code> 即可查看扩容效果。</p>
</li>
</ol>
</li>
</ol>
<h1 id="家宽ipv6-DDNS公网访问"><a href="#家宽ipv6-DDNS公网访问" class="headerlink" title="家宽ipv6 DDNS公网访问"></a>家宽ipv6 DDNS公网访问</h1><blockquote>
<p>现在家宽基本只能给到动态的公网ipv6了，有很多DDNS服务的提供商。阿里云也提供付费的DDNS服务，这里以免费的<a target="_blank" rel="noopener" href="https://dynv6.com">dynv6</a>为例进行部署。</p>
</blockquote>
<p>在dynv6申请了子域名之后进入<code>Documentations -&gt; APIs</code>，在管理界面复制<code>token</code>中的内容。对于路由器而言，我们的需求是路由器应当能够定期向dynv6网站汇报自己的IP地址，在Openwrt里我们采用DDNS软件包完成这件事。</p>
<p>一般来说固件编译的时候就包含了这个软件包，在<code>服务 -&gt; 动态DNS</code>中进入DDNS界面。添加一条DDNS规则时注意要将ipv4以及ipv6分别添加，我这里只有ipv6的公网，那就只添加ipv6的规则。其中部分字段可以参考以下表格：</p>
<div class="table-container">
<table>
<thead>
<tr>
<th style="text-align:center">字段</th>
<th>值</th>
<th style="text-align:left">备注</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">启用</td>
<td>勾选</td>
<td style="text-align:left"></td>
</tr>
<tr>
<td style="text-align:center">查询主机名</td>
<td>ipv6.dynv6.com</td>
<td style="text-align:left">这是采用dynv6进行ddns的固定填写方式</td>
</tr>
<tr>
<td style="text-align:center">IP地址版本</td>
<td>ipv6地址</td>
<td style="text-align:left"></td>
</tr>
<tr>
<td style="text-align:center">DDNS服务提供商</td>
<td>dynv6.com</td>
<td style="text-align:left"></td>
</tr>
<tr>
<td style="text-align:center">域名</td>
<td>xxxx.dynv6.com</td>
<td style="text-align:left">填写申请的子域名</td>
</tr>
<tr>
<td style="text-align:center">密码</td>
<td><strong><strong><strong>**</strong></strong></strong></td>
<td style="text-align:left">填写之前复制的token</td>
</tr>
<tr>
<td style="text-align:center">IP地址来源</td>
<td>URL</td>
<td style="text-align:left">以下为高级设置</td>
</tr>
<tr>
<td style="text-align:center">用于检测的URL</td>
<td><a target="_blank" rel="noopener" href="http://checkipv6.dyndns.com">http://checkipv6.dyndns.com</a></td>
<td style="text-align:left"></td>
</tr>
<tr>
<td style="text-align:center">事件网络</td>
<td>wan</td>
</tr>
</tbody>
</table>
</div>
<p>其他没有涉及的字段可以考虑保持默认设置，再自行设置定时器（更新频率）。地址来源选择URL即可以使用运营商分配的/64短码IPv6地址，看起来美观一些，当然，实际使用上并没有太大区别</p>
<p>随后保存并应用即可，可以试试用路由器的诊断工具测试IPv6的连接情况，访问<a target="_blank" rel="noopener" href="http://checkipv6.dyndns.com/">这里</a>或<a target="_blank" rel="noopener" href="https://testipv6.cn">这里</a>得到你的IPv6地址（电脑访问得到电脑的，路由器访问得到路由器的，由于在这里没有NAT的概念，我们说的都是全局的、唯一的IPv6地址）</p>
<p>可以看到现在DDNS检查进程已经启动了，如果没有显示进程的PID，那么手动点击“启动”即可。</p>
<p>当然，我们可以发现API界面也推荐使用一个小脚本进行更新。可以在路由器上部署此脚本的定时任务完成这一需求。</p>
<p>如果配置完成后，地址更新成功且<a href="https://testipv6.cn测试通过，但仍旧不能从外网访问路由器，可能有以下几种原因：">https://testipv6.cn测试通过，但仍旧不能从外网访问路由器，可能有以下几种原因：</a></p>
<ul>
<li><p>运营商分配了IPv6，但禁止了传入连接（罕见，多见于教育网、机关单位等统一配置的防火墙，个人无法解决）</p>
</li>
<li><p>光猫拨号，向下级设备分配了IPv6地址，但光猫的防火墙禁止了传入连接（较常见，可通过修改光猫配置关闭防火墙或改为桥接模式、路由器拨号）</p>
</li>
<li><p>Openwrt自带防火墙默认拒绝传入连接（常见，修改设置即可，参考：<a target="_blank" rel="noopener" href="https://blog.csdn.net/weixin_43593122/article/details/95766357）">https://blog.csdn.net/weixin_43593122/article/details/95766357）</a></p>
</li>
<li><p>运营商禁用了常用端口80、443、8080等（常见，修改http服务器的端口再次测试即可，参考：<a target="_blank" rel="noopener" href="https://blog.csdn.net/weixin_43593122/article/details/95766357）">https://blog.csdn.net/weixin_43593122/article/details/95766357）</a></p>
</li>
</ul>
<h1 id="Docker安装X-UI"><a href="#Docker安装X-UI" class="headerlink" title="Docker安装X-UI"></a>Docker安装X-UI</h1><p>Openwrt已经编译包含了Docker，在自建服务器中可以使用<code>curl -fsSL https://get.docker.com | sh</code>完成Docker的安装，安装完之后会自动启动。</p>
<p>推荐新建一个<code>x-ui</code>的目录进行部署：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">mkdir x-ui &amp;&amp; cd x-ui</span><br><span class="line">docker run -itd --network=host -v $PWD/db/:/etc/x-ui/ -v $PWD/cert/:/root/cert/ --name x-ui --restart=unless-stopped enwaiax/x-ui:latest</span><br></pre></td></tr></table></figure>
<p>访问<code>http://服务器IP:54321</code>使用账号admin密码admin登录.注意需开放相关端口防火墙,并及时修改账号密码。</p>
<p>如果没有自动启动Docker那就试试看重启路由器，我就重启法修复了，不明所以。</p>
<p>可以先检索所有运行中的Docker然后根据ID进入Docker环境：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">docker ps</span><br><span class="line">docker exec -it XXXX /bin/bash # 容器ID</span><br></pre></td></tr></table></figure>
<h1 id="Docker安装青龙"><a href="#Docker安装青龙" class="headerlink" title="Docker安装青龙"></a>Docker安装青龙</h1><blockquote>
<p>青龙面板仓库地址：<a target="_blank" rel="noopener" href="https://hub.docker.com/r/whyour/qinglong" title="Docker Hub">Docker Hub</a></p>
</blockquote>
<h2 id="拉取镜像"><a href="#拉取镜像" class="headerlink" title="拉取镜像"></a>拉取镜像</h2><p>使用以下命令拉取青龙面板的镜像，等待下载完成（失败或缓慢可以挂梯子）</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker pull whyour/qinglong:latest</span><br></pre></td></tr></table></figure>
<h2 id="创建容器"><a href="#创建容器" class="headerlink" title="创建容器"></a>创建容器</h2><p>命令行输入一下命令创建容器，如果报错那就重启路由器再试试：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">docker run -dit \</span><br><span class="line">-v $pwd/ql/config:/ql/config \</span><br><span class="line">-v $pwd/ql/log:/ql/log \</span><br><span class="line">-v $pwd/ql/db:/ql/db \</span><br><span class="line">-v $pwd/ql/scripts:/ql/scripts \</span><br><span class="line">-v $pwd/ql/jbot:/ql/jbot \</span><br><span class="line">-p 5700:5700 \</span><br><span class="line">-e ENABLE_HANGUP=true \</span><br><span class="line">-e ENABLE_WEB_PANEL=true \</span><br><span class="line">--name qinglong \</span><br><span class="line">--hostname qinglong \</span><br><span class="line">--restart always \</span><br><span class="line">whyour/qinglong:latest</span><br></pre></td></tr></table></figure>
<h2 id="登录面板"><a href="#登录面板" class="headerlink" title="登录面板"></a>登录面板</h2><p>默认地址为openwrt后台管理ip+端口5700，例如<code>192.168.8.1:5700</code>或者之前DDNS的域名＋端口，在浏览器打开即可完成配置。</p>
 
      <!-- reward -->
      
      <div id="reword-out">
        <div id="reward-btn">
          打赏
        </div>
      </div>
      
    </div>
    

    <!-- copyright -->
    
    <div class="declare">
      <ul class="post-copyright">
        <li>
          <i class="ri-copyright-line"></i>
          <strong>版权声明： </strong>
          
          本博客所有文章除特别声明外，著作权归作者所有。转载请注明出处！
          
        </li>
      </ul>
    </div>
    
    <footer class="article-footer">
       
<div class="share-btn">
      <span class="share-sns share-outer">
        <i class="ri-share-forward-line"></i>
        分享
      </span>
      <div class="share-wrap">
        <i class="arrow"></i>
        <div class="share-icons">
          
          <a class="weibo share-sns" href="javascript:;" data-type="weibo">
            <i class="ri-weibo-fill"></i>
          </a>
          <a class="weixin share-sns wxFab" href="javascript:;" data-type="weixin">
            <i class="ri-wechat-fill"></i>
          </a>
          <a class="qq share-sns" href="javascript:;" data-type="qq">
            <i class="ri-qq-fill"></i>
          </a>
          <a class="douban share-sns" href="javascript:;" data-type="douban">
            <i class="ri-douban-line"></i>
          </a>
          <!-- <a class="qzone share-sns" href="javascript:;" data-type="qzone">
            <i class="icon icon-qzone"></i>
          </a> -->
          
          <a class="facebook share-sns" href="javascript:;" data-type="facebook">
            <i class="ri-facebook-circle-fill"></i>
          </a>
          <a class="twitter share-sns" href="javascript:;" data-type="twitter">
            <i class="ri-twitter-fill"></i>
          </a>
          <a class="google share-sns" href="javascript:;" data-type="google">
            <i class="ri-google-fill"></i>
          </a>
        </div>
      </div>
</div>

<div class="wx-share-modal">
    <a class="modal-close" href="javascript:;"><i class="ri-close-circle-line"></i></a>
    <p>扫一扫，分享到微信</p>
    <div class="wx-qrcode">
      <img src="//api.qrserver.com/v1/create-qr-code/?size=150x150&data=https://blog.shimmerjordan.eu.org/2023/01/07/soft-routing-setup/" alt="微信分享二维码">
    </div>
</div>

<div id="share-mask"></div>  
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/%E8%BD%AF%E8%B7%AF%E7%94%B1/" rel="tag">软路由</a></li></ul>

    </footer>
  </div>

   
  <nav class="article-nav">
    
      <a href="/2023/01/09/GS3101-bridge/" class="article-nav-link">
        <strong class="article-nav-caption">上一篇</strong>
        <div class="article-nav-title">
          
            移动光猫吉比特GS3101超级账号获取更改桥接
          
        </div>
      </a>
    
    
      <a href="/2022/07/08/url-visit/" class="article-nav-link">
        <strong class="article-nav-caption">下一篇</strong>
        <div class="article-nav-title">浏览器输入URL访问网页的执行流程</div>
      </a>
    
  </nav>

   
<!-- valine评论 -->
<div id="vcomments-box">
  <div id="vcomments"></div>
</div>
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/valine@1.4.14/dist/Valine.min.js"></script>
<script>
  new Valine({
    el: "#vcomments",
    app_id: "StYfTMDp78X0EltFR16ve2q5-gzGzoHsz",
    app_key: "G4RPxRpXG6RwdfpnJefOSnyy",
    path: window.location.pathname,
    avatar: "wavatar",
    placeholder: "ヾﾉ≧∀≦)o来啊，快活啊!",
    recordIP: true,
  });
  const infoEle = document.querySelector("#vcomments .info");
  if (infoEle && infoEle.childNodes && infoEle.childNodes.length > 0) {
    infoEle.childNodes.forEach(function (item) {
      item.parentNode.removeChild(item);
    });
  }
</script>
<style>
  #vcomments-box {
    padding: 5px 30px;
  }

  @media screen and (max-width: 800px) {
    #vcomments-box {
      padding: 5px 0px;
    }
  }

  #vcomments-box #vcomments {
    background-color: #fff;
  }

  .v .vlist .vcard .vh {
    padding-right: 20px;
  }

  .v .vlist .vcard {
    padding-left: 10px;
  }
</style>

 
   
   
<!-- minivaline评论 -->
<div id="mvcomments-box">
  <div id="mvcomments"></div>
</div>
<script src="https://cdn.jsdelivr.net/npm/minivaline@latest"></script>
<script>
    new MiniValine(Object.assign({"enable":true,"mode":"DesertsP","placeholder":"Write a Comment","math":true,"md":true,"enableQQ":true,"NoRecordIP":false,"visitor":true,"maxNest":6,"pageSize":6,"adminEmailMd5":"de8a7aa53d07e6b6bceb45c64027763d","tagMeta":["管理员","小伙伴","访客"],"master":["de8a7aa53d07e6b6bceb45c64027763d"],"friends":["b5bd5d836c7a0091aa8473e79ed4c25e","adb7d1cd192658a55c0ad22a3309cecf","3ce1e6c77b4910f1871106cb30dc62b0","cfce8dc43725cc14ffcd9fb4892d5bfc"],"lang":null,"emoticonUrl":["https://cdn.jsdelivr.net/npm/alus@latest","https://cdn.jsdelivr.net/gh/MiniValine/qq@latest","https://cdn.jsdelivr.net/gh/MiniValine/Bilibilis@latest","https://cdn.jsdelivr.net/gh/MiniValine/tieba@latest","https://cdn.jsdelivr.net/gh/MiniValine/twemoji@latest","https://cdn.jsdelivr.net/gh/MiniValine/weibo@latest"]}, {
	  el: '#mvcomments',
    }));
  const infoEle = document.querySelector('#mvcomments .info');
  if (infoEle && infoEle.childNodes && infoEle.childNodes.length > 0) {
      infoEle.childNodes.forEach(function (item) {
          item.parentNode.removeChild(item);
      });
  }
</script>
<style>
	#mvcomments-box {
		padding: 5px 30px;
	}
	@media screen and (max-width: 800px) {
		#mvcomments-box {
		  padding: 5px 0px;
		}
	}
	.darkmode .MiniValine *{
		color: #f1f1f1!important;
	}
	.darkmode .commentTrigger{
		background-color: #403e3e !important;
	  }
	.darkmode .MiniValine .vpage .more{
		background: #21232F
	}
	.darkmode img{
		filter: brightness(30%)
	}
	.darkmode .MiniValine .vlist .vcard .vcomment-body .text-wrapper .vcomment.expand:before{
		background: linear-gradient(180deg, rgba(246,246,246,0), rgba(0,0,0,0.9))
	}
	.darkmode .MiniValine .vlist .vcard .vcomment-body .text-wrapper .vcomment.expand:after{
		background: rgba(0,0,0,0.9)
	}
	.darkmode .MiniValine .vlist .vcard .vcomment-body .text-wrapper .vcomment pre{
		background: #282c34
		border: 1px solid #282c34
	}
	.darkmode .MiniValine .vinputs-area .textarea-wrapper textarea{
		color: #000;
	}
	.darkmode .MiniValine .vinputs-area .auth-section .input-wrapper input{
		color: #000;
	}
	.darkmode .MiniValine .vinputs-area .vextra-area .vsmile-icons{
		background: transparent;
	}
	.darkmode .MiniValine .vinputs-wrap{
		border-color: #b2b2b5;
	}
	.darkmode .MiniValine .vinputs-wrap:hover{
		border: 1px dashed #2196f3;
	}
	.darkmode .MiniValine .vinputs-area .auth-section .input-wrapper{
		border-bottom: 1px dashed #b2b2b5;
	}
	.darkmode .MiniValine .vinputs-area .auth-section .input-wrapper:hover{
		border-bottom: 1px dashed #2196f3;
	}
	.darkmode .MiniValine .vbtn{
		background-color: transparent!important;
	}
	.darkmode .MiniValine .vbtn:hover{
		border: 1px dashed #2196f3;
	}
</style>

    
</article>

</section>
      <footer class="footer">
  <div class="outer">
    <ul>
      <li>
        Copyrights &copy;
        2019-2024
        <i class="ri-heart-fill heart_icon"></i> 鞠桥丹-QIAODAN JU
      </li>
    </ul>
    <ul>
      <li>
        
        
        
        由 <a href="https://hexo.io" target="_blank">Hexo</a> 强力驱动
        <span class="division">|</span>
        主题 - <a href="https://github.com/Shen-Yu/hexo-theme-ayer" target="_blank">Ayer</a>
        
      </li>
    </ul>
    <ul>
      <li>
        
        
        <span>
  <span><i class="ri-user-3-fill"></i>访问人数:<span id="busuanzi_value_site_uv"></span></s>
  <span class="division">|</span>
  <span><i class="ri-eye-fill"></i>浏览次数:<span id="busuanzi_value_page_pv"></span></span>
</span>
        
      </li>
    </ul>
    <ul>
      
    </ul>
    <ul>
      
    </ul>
    <ul>
      <li>
        <!-- cnzz统计 -->
        
        <script type="text/javascript" src='https://s4.cnzz.com/z_stat.php?id=1279035150&amp;web_id=1279035150'></script>
        
      </li>
    </ul>
  </div>
</footer>
      <div class="float_btns">
        <div class="totop" id="totop">
  <i class="ri-arrow-up-line"></i>
</div>

<div class="todark" id="todark">
  <i class="ri-moon-line"></i>
</div>

      </div>
    </main>
    <aside class="sidebar on">
      <button class="navbar-toggle"></button>
<nav class="navbar">
  
  <div class="logo">
    <a href="/"><img src="/images/ayer-side.svg" alt="丛烨-shimmerjordan"></a>
  </div>
  
  <ul class="nav nav-main">
    
    <li class="nav-item">
      <a class="nav-item-link" href="/">Home</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/archives">Catalogue</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags">Tags</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/%E9%9A%8F%E7%AC%94/">Essay</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/categories">Archives</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/friends">Friends</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/2020/01/18/about">About</a>
    </li>
    
  </ul>
</nav>
<nav class="navbar navbar-bottom">
  <ul class="nav">
    <li class="nav-item">
      
      <a class="nav-item-link nav-item-search"  title="搜索">
        <i class="ri-search-line"></i>
      </a>
      
      
      <a class="nav-item-link" target="_blank" href="/atom.xml" title="RSS Feed">
        <i class="ri-rss-line"></i>
      </a>
      
    </li>
  </ul>
</nav>
<div class="search-form-wrap">
  <div class="local-search local-search-plugin">
  <input type="search" id="local-search-input" class="local-search-input" placeholder="Search...">
  <div id="local-search-result" class="local-search-result"></div>
</div>
</div>
    </aside>
    <script>
      if (window.matchMedia("(max-width: 768px)").matches) {
        document.querySelector('.content').classList.remove('on');
        document.querySelector('.sidebar').classList.remove('on');
      }
    </script>
    <div id="mask"></div>

<!-- #reward -->
<div id="reward">
  <span class="close"><i class="ri-close-line"></i></span>
  <p class="reward-p"><i class="ri-cup-line"></i>请我喝杯蓝莓汁吧~</p>
  <div class="reward-box">
    
    <div class="reward-item">
      <img class="reward-img" src="/images/alipay.jpg">
      <span class="reward-type">支付宝</span>
    </div>
    
    
    <div class="reward-item">
      <img class="reward-img" src="/images/wechat.jpg">
      <span class="reward-type">微信</span>
    </div>
    
  </div>
</div>
    
<script src="/js/jquery-2.0.3.min.js"></script>


<script src="/js/lazyload.min.js"></script>

<!-- Tocbot -->


<script src="/js/tocbot.min.js"></script>

<script>
  tocbot.init({
    tocSelector: '.tocbot',
    contentSelector: '.article-entry',
    headingSelector: 'h1, h2, h3, h4, h5, h6',
    hasInnerContainers: true,
    scrollSmooth: true,
    scrollContainer: 'main',
    positionFixedSelector: '.tocbot',
    positionFixedClass: 'is-position-fixed',
    fixedSidebarOffset: 'auto'
  });
</script>

<script src="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.css">
<script src="https://cdn.jsdelivr.net/npm/justifiedGallery@3.7.0/dist/js/jquery.justifiedGallery.min.js"></script>

<script src="/dist/main.js"></script>

<!-- ImageViewer -->

<!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">

    <!-- Background of PhotoSwipe. 
         It's a separate element as animating opacity is faster than rgba(). -->
    <div class="pswp__bg"></div>

    <!-- Slides wrapper with overflow:hidden. -->
    <div class="pswp__scroll-wrap">

        <!-- Container that holds slides. 
            PhotoSwipe keeps only 3 of them in the DOM to save memory.
            Don't modify these 3 pswp__item elements, data is added later on. -->
        <div class="pswp__container">
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
        </div>

        <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
        <div class="pswp__ui pswp__ui--hidden">

            <div class="pswp__top-bar">

                <!--  Controls are self-explanatory. Order can be changed. -->

                <div class="pswp__counter"></div>

                <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>

                <button class="pswp__button pswp__button--share" style="display:none" title="Share"></button>

                <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>

                <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>

                <!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR -->
                <!-- element will get class pswp__preloader--active when preloader is running -->
                <div class="pswp__preloader">
                    <div class="pswp__preloader__icn">
                        <div class="pswp__preloader__cut">
                            <div class="pswp__preloader__donut"></div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
                <div class="pswp__share-tooltip"></div>
            </div>

            <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
            </button>

            <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
            </button>

            <div class="pswp__caption">
                <div class="pswp__caption__center"></div>
            </div>

        </div>

    </div>

</div>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/default-skin/default-skin.min.css">
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe-ui-default.min.js"></script>

<script>
    function viewer_init() {
        let pswpElement = document.querySelectorAll('.pswp')[0];
        let $imgArr = document.querySelectorAll(('.article-entry img:not(.reward-img)'))

        $imgArr.forEach(($em, i) => {
            $em.onclick = () => {
                // slider展开状态
                // todo: 这样不好，后面改成状态
                if (document.querySelector('.left-col.show')) return
                let items = []
                $imgArr.forEach(($em2, i2) => {
                    let img = $em2.getAttribute('data-idx', i2)
                    let src = $em2.getAttribute('data-target') || $em2.getAttribute('src')
                    let title = $em2.getAttribute('alt')
                    // 获得原图尺寸
                    const image = new Image()
                    image.src = src
                    items.push({
                        src: src,
                        w: image.width || $em2.width,
                        h: image.height || $em2.height,
                        title: title
                    })
                })
                var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, {
                    index: parseInt(i)
                });
                gallery.init()
            }
        })
    }
    viewer_init()
</script>

<!-- MathJax -->

<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
      tex2jax: {
          inlineMath: [ ['$','$'], ["\\(","\\)"]  ],
          processEscapes: true,
          skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
      }
  });

  MathJax.Hub.Queue(function() {
      var all = MathJax.Hub.getAllJax(), i;
      for(i=0; i < all.length; i += 1) {
          all[i].SourceElement().parentNode.className += ' has-jax';
      }
  });
</script>

<script src="https://cdn.jsdelivr.net/npm/mathjax@2.7.6/unpacked/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script>
  var ayerConfig = {
    mathjax: true
  }
</script>

<!-- Katex -->

<!-- busuanzi  -->


<script src="/js/busuanzi-2.3.pure.min.js"></script>


<!-- ClickLove -->


<script src="/js/clickLove.js"></script>


<!-- ClickBoom1 -->

<!-- ClickBoom2 -->

<!-- CodeCopy -->


<link rel="stylesheet" href="/css/clipboard.css">

<script src="https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js"></script>
<script>
  function wait(callback, seconds) {
    var timelag = null;
    timelag = window.setTimeout(callback, seconds);
  }
  !function (e, t, a) {
    var initCopyCode = function(){
      var copyHtml = '';
      copyHtml += '<button class="btn-copy" data-clipboard-snippet="">';
      copyHtml += '<i class="ri-file-copy-2-line"></i><span>COPY</span>';
      copyHtml += '</button>';
      $(".highlight .code pre").before(copyHtml);
      $(".article pre code").before(copyHtml);
      var clipboard = new ClipboardJS('.btn-copy', {
        target: function(trigger) {
          return trigger.nextElementSibling;
        }
      });
      clipboard.on('success', function(e) {
        let $btn = $(e.trigger);
        $btn.addClass('copied');
        let $icon = $($btn.find('i'));
        $icon.removeClass('ri-file-copy-2-line');
        $icon.addClass('ri-checkbox-circle-line');
        let $span = $($btn.find('span'));
        $span[0].innerText = 'COPIED';
        
        wait(function () { // 等待两秒钟后恢复
          $icon.removeClass('ri-checkbox-circle-line');
          $icon.addClass('ri-file-copy-2-line');
          $span[0].innerText = 'COPY';
        }, 2000);
      });
      clipboard.on('error', function(e) {
        e.clearSelection();
        let $btn = $(e.trigger);
        $btn.addClass('copy-failed');
        let $icon = $($btn.find('i'));
        $icon.removeClass('ri-file-copy-2-line');
        $icon.addClass('ri-time-line');
        let $span = $($btn.find('span'));
        $span[0].innerText = 'COPY FAILED';
        
        wait(function () { // 等待两秒钟后恢复
          $icon.removeClass('ri-time-line');
          $icon.addClass('ri-file-copy-2-line');
          $span[0].innerText = 'COPY';
        }, 2000);
      });
    }
    initCopyCode();
  }(window, document);
</script>


<!-- CanvasBackground -->


<script src="/js/dz.js"></script>



    
  </div>
</body>

</html>